<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var img = document.createElement("img");

        img.src = "https://hbimg.huabanimg.com/67f0a83beff314d5a0dc585f0d47422282c9029e9cd6-AYHPMT_fw240/format/webp";

        console.log(img.width)
        console.log(img.height)
        // 图片加载事件  其实 script标签 link标签 video标签 audio标签等引入外部资源的标签都有加载事件
        img.onload = function () {
            console.log(this.width)
            console.log(this.height)
        }
        

    </script>
</body>

</html>